import http from './index'

//服务列表接口
export function pubServiceList_api(params) {
	const token = window.localStorage.getItem('token')
	return http.post('/bizManagement/servicePub/queryPageToManage',
		{
		page: params.page,
		serviceName: params.pubServiceName,
		serviceType: params.pubServiceType,
		recommend: params.recommend != "" ? (params.recommend == '推荐' ? 'Y' : 'N')  : "",
		auditStatus: params.auditStatus
		},
		{
			headers: {
				'Authorization': token,
				'Content-Type': 'application/json'
			}
		},
		)
		.then(res => {
			return res.data
		})
}

//更改服务状态接口
export function updateAuditStatus_api(params) {
	const token = window.localStorage.getItem('token')
	return http.post('/bizManagement/servicePub/updateAuditStatus',
		{
		id: params.id,
		status: params.status,
		reason: params.reason
		},
		{
			headers: {
				'Authorization': token,
				'Content-Type': 'application/json'
			}
		},
		)
		.then(res => {
			return res.data
		})
}


//删除服务接口
export function delete_api(params) {
	const token = window.localStorage.getItem('token')
	return http.post('/bizManagement/servicePub/delete',
		{
		ids: params.id
		},
		{
			headers: {
				'Authorization': token,
				'Content-Type': 'application/json'
			}
		},
		)
		.then(res => {
			return res.data
		})
}

//更新是否推荐接口
export function updateRecommend_api(params) {
	const token = window.localStorage.getItem('token')
	console.log("====>", params)
	return http.post('/bizManagement/servicePub/updateRecommend',
		{
		id: params.id
		},
		{
			headers: {
				'Authorization': token,
				'Content-Type': 'application/json'
			}
		},
		)
		.then(res => {
			return res.data
		})
}

//查询服务类型接口
export function getServiceType_api() {
	const token = window.localStorage.getItem('token')
	return http.get('/management/dict/item/queryItemsByGroupCode?groupCode=SERVICE_TYPE', null)
		.then(res => {
			return res.data
		})
}